<!--
 * @Author: 1243sd 782012816@qq.com
 * @Date: 2024-03-14 23:18:02
 * @LastEditors: 1243sd 782012816@qq.com
 * @LastEditTime: 2024-03-27 22:52:23
 * @FilePath: \frontend-ykt-admin\src\views\points\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!---- 积分流水明细列表 ---->
<template>
    <div class="container">
        <b-card-new>
            <b-query-form-new ref="bForm" :data="formData" :form="dataForm.query" @search="handleSearch"></b-query-form-new>
            <b-query-table ref="bTable" :init-columns="initColumns()" :data-form="dataForm"></b-query-table>
        </b-card-new>
    </div>
</template>
<script>
import mixinPageHeight from "@/mixinPageHeight"
export default {
    mixins:[mixinPageHeight],
    data() {
        return {
            formData:[
                { typeCode: "selectFilter", title: "会员昵称", name: "official_account_user_id", jsName: "member", fnName: "member_list", vname: "nickname" },
                { typeCode: "select", title: "变更类型", name: "serveType", kname: 'code', vname: 'name', optionData: [] },
                { typeCode: "select", title: "操作人角色", name: "operator_id", optionData: [{key: 'superman', value: '超级管理员'}, {key: 'sys_admin', value: '一口甜管理人员'}, {key: 'proxy_admin', value: '代理人='}] },
                { typeCode: "input", title: "提现申请id", name: "withdraw_apply_id" },
                { typeCode: "datePickerRangeI", span: 8, title: "创建时间", name: "created_time", start: "created_at_start", end: "created_at_end" },
            ],
            dataForm:{
                url:"/api/points_change_log/page_list",
                query:{
                    official_account_user_id: '', // 会员id
                    change_type: "", // 变更类型   MANUAL：人工操作  WITHDRAW：提现  FINACE：金融还款
                    operator_id: "", // 操作人id
                    // trans_sn: "", // 
                    withdraw_apply_id: "", // 提现申请id
                    created_at_start: "", // 开始时间
                    created_at_end: "", // 结束时间

                }
            }
        }
    },
    created() {
        // 变更类型枚举
        this.$api.setting.get_options('ofa_user.points_change_type').then(res => {
            this.formData[1].optionData = res || []
        })
    },
    methods:{
        initColumns() {
            return [
                { title:"申请记录id", valueName:"id" },
                { title:"申请人id", valueName:"official_account_user_id" },
                { title:"会员姓名", valueName:"official_account_user_name" },
                { title:"现有积分", valueName:"points" },
                { title:"变更前积分", valueName:"points_before" },
                { title:"变更后积分", valueName:"points_after" },
                { title:"变更类型", valueName:"change_type_name" },
                { title:"操作人员角色", valueName:"operator_name" },
                { title:"变更时间", valueName:"created_at" },
                { title:"还款交易单号", valueName:"trans_sn" },
                { title:"提现打款时间", valueName:"withdraw_time" },
            ]
        }
    }
}
</script>